﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/InSite.Master" CodeBehind="Log.aspx.vb" Inherits="Core.Log" 
    title="Hệ thống Logging" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<style type="text/css" media="all">
		@import url(/static/inSite/css/redmond.datepick.css);
		.datepick-trigger{cursor:pointer;margin-bottom: -5px;}
</style>
<script src="/static/inSite/js/jquery.datepick.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('#ctl00_ContentPlaceHolder1_txtDateStart').datepick({ showOnFocus: false, showTrigger: '<img src="/static/inSite/images/date.png" alt="..."></img>' });
        $('#ctl00_ContentPlaceHolder1_txtDateEnd').datepick({ showOnFocus: false, showTrigger: '<img src="/static/inSite/images/date.png" alt="..."></img>' });
        
    });
</script>

    <div class="demoarea">
<script language="javascript" type="text/javascript">
            var lengtview = 30;
            function CheckGroup(obj, val, grdid, objid) {
                var chkbox;
                var i = 2;
                if (i < 10) {
                    chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objid);
                }
                else {
                    chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objid);
                }
                for (var k = 0; k < lengtview; k++) {
                    if (chkbox != null) {
                        if (chkbox.getAttribute("group") == val) {
                            if (obj.checked) {
                                chkbox.checked = true;
                            }
                            else {
                                chkbox.checked = false;
                            }
                        }
                    }
                    i = i + 1;
                    if (i < 10) {
                        chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objid);
                    }
                    else {
                        chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objid);
                    }
                }
            }
            function DGSelectOrUnselectAll(grdid, obj, objlist) {
                //this function decides whether to check or uncheck all 
                if (obj.checked)
                    DGSelectAll(grdid, objlist, 1, lengtview)
                else
                    DGSelectAll(grdid, objlist, 0, lengtview)
            }
            //----------
            function DGSelectAll(grdid, objid, check, lengtview) {
                //.this function is to check all the items
                var chkbox;
                var i = 2;
                if (i < 10) {
                    chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objid);
                }
                else {
                    chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objid);
                }
                //while (chkbox != null) 
                for (var k = 0; k < lengtview; k++) {
                    if (chkbox != null) {
                        if (check == 1) {
                            chkbox.checked = true;
                        }
                        else {
                            chkbox.checked = false;
                        }
                    }
                    i = i + 1;
                    if (i < 10) {
                        chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objid);
                    }
                    else {
                        chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objid);
                    }
                }
            }
            function DGCheckOne(grdid, obj, objlist) {
                var chkbox;
                var i = 2;
                if (i < 10) {
                    chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objlist);
                }
                else {
                    chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objlist);
                }
                while (chkbox != null) {
                    chkbox.checked = false;
                    i = i + 1;
                    if (i < 10) {
                        chkbox = document.getElementById(grdid + '_ctl0' + i + '_' + objlist);
                    }
                    else {
                        chkbox = document.getElementById(grdid + '_ctl' + i + '_' + objlist);
                    }
                }
                obj.checked = true;
            }
</script>

    <fieldset style="margin: 0 auto;">
    <legend>Thông tin chi tiết</legend>
    <table width="100%" border="1">
        <tr>
            <td valign="top">
                <table width="100%">
                    <tr>
                        <td style="width:100px; color: #666666; height: 6px;">
                            Tài khoản:
                        </td>
                        <td style="height: 6px">
                            <asp:TextBox  ID="txtUsername" class="mediumfield" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td style="width:100px; color: #666666;">
                            Thao tác:
                        </td>
                        <td>
                            <asp:DropDownList ID="cbxAction" Width="218px" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top">
                <table width="100%">
                    <tr>
                        <td style="width:100px; color: #666666;">
                            Ngày bắt đầu:
                        </td>
                        <td>
                            <asp:TextBox ID="txtDateStart" class="mediumfield" runat="server"></asp:TextBox>
                            
                        </td>
                    </tr>
                    <tr>
                        <td style="width:100px; color: #666666;">
                            Ngày kết thúc:
                        </td>
                        <td>
                            <asp:TextBox ID="txtDateEnd" class="mediumfield" runat="server"></asp:TextBox>
                            
						</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" class="button" Height="26px" style="float:none" Width="70"/>
                <asp:Button ID="btnDelete" runat="server" Text="Xóa" class="button" Height="26px" style="float:none" Width="50" OnClientClick="return confirm('Bạn có chắc muốn Log đang được chọn?');"/>
                <asp:Button ID="btnDeleteAll" runat="server" Text="Xóa toàn bộ" class="button" Height="26px" style="float:none" Width="85" OnClientClick="return confirm('Bạn có chắc muốn xóa hết toàn bộ Log của hệ thống?');"/>
            </td>
        </tr>
    </table>   
</fieldset>
<br /><br />

<fieldset>
    <legend>Danh sách Log</legend>
    <asp:SqlDataSource ID="dsSource" runat="server"></asp:SqlDataSource>


    <asp:GridView ID="gridMenu" runat="server" DataSourceID="dsSource" class="tblMain" 
            AutoGenerateColumns="false" GridLines="None" AllowPaging="True" 
            PageSize="20" AllowSorting="True" DataKeyNames="LogID" HeaderStyle-BackColor="#9097a9">
        <Columns>
            <asp:TemplateField HeaderText="View">
                <HeaderTemplate>
                    <input type="checkbox" id="chkViewAll" onclick="DGSelectOrUnselectAll('ctl00_ContentPlaceHolder1_gridMenu',this,'chkView')"/>
                </HeaderTemplate>
                <ItemTemplate>
                    <input type="checkbox" id="chkView" runat="server" />
                </ItemTemplate>
                <HeaderStyle Width="1px" HorizontalAlign="center" />
                <ItemStyle Width="1px" HorizontalAlign="center" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="No.">
                <ItemTemplate>
                    <%--<asp:Label Visible="true" runat="server" ID="lbl_ID" Text='<%#Eval("LogID") %>'></asp:Label>--%>
                    <asp:Label runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="50px" HorizontalAlign="Left" />
                <ItemStyle Width="50px" />
            </asp:TemplateField>
            <asp:BoundField HeaderText="Tài khoản" DataField="UserName" SortExpression="UserName" >
                <HeaderStyle Width="100px" HorizontalAlign="Left" />
                <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:BoundField HeaderText="Log 1" DataField="Field1" SortExpression="Field1" >
                <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField HeaderText="Log 2" DataField="Field2" SortExpression="Field2" >
                <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField HeaderText="Log 3" DataField="Field3" SortExpression="Field3" >
                <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Thời điểm">
                <ItemTemplate>
                     <asp:Label ID="lbTime" runat="server" Text='<%#formatTime(Eval("LogDate")) %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="130px" HorizontalAlign="Left" />
                <ItemStyle Width="130px" />
            </asp:TemplateField>
        </Columns>
        <PagerStyle HorizontalAlign="Center" />
                    
    </asp:GridView>
    
  </fieldset>
</asp:Content>
